Skip to content

Conversation

Nadharm
Copy link
Contributor

@Nadharm Nadharm commented Aug 15, 2025

Fixes: warning C4146: unary minus operator applied to unsigned type, result still unsigned

Fixes:
warning C4146: unary minus operator applied to unsigned type, result still unsigned
@llvmbot
Copy link
Member

llvmbot commented Aug 15, 2025

@llvm/pr-subscribers-llvm-ir

Author: None (Nadharm)

Changes

Fixes: warning C4146: unary minus operator applied to unsigned type, result still unsigned


Full diff: https://github.com/llvm/llvm-project/pull/153887.diff

1 Files Affected:

  • (modified) llvm/include/llvm/IR/BasicBlock.h (+1-1)
diff --git a/llvm/include/llvm/IR/BasicBlock.h b/llvm/include/llvm/IR/BasicBlock.h
index c24f01fe26cc8..533808e0666d5 100644
--- a/llvm/include/llvm/IR/BasicBlock.h
+++ b/llvm/include/llvm/IR/BasicBlock.h
@@ -68,7 +68,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
   // Allow Function to renumber blocks.
   friend class Function;
   /// Per-function unique number.
-  unsigned Number = -1u;
+  unsigned Number = ~0u;
 
   friend class BlockAddress;
   friend class SymbolTableListTraits<BasicBlock>;

@Nadharm
Copy link
Contributor Author

Nadharm commented Aug 15, 2025

@AlexMaclean

Copy link
Member

@AlexMaclean AlexMaclean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Nadharm
Copy link
Contributor Author

Nadharm commented Aug 17, 2025

@AlexMaclean could you merge this for me please? I don't have permissions

@AlexMaclean AlexMaclean merged commit 83a1b40 into llvm:main Aug 18, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants